// 导入express
const express = require('express')
// 导入验证 验证规则 的模块
const expressJoi = require('@escook/express-joi')

// 导入路由对应处理函数
const { release, obtain, deleteDynamic, getById, updateDynamic, updateVisibility } = require('../router_handler/dynamic_handler')
// 导入发布动态验证规则
const { weite_dynamic_schema, delete_dynamic_schema, getById_dynamic_schema, update_content_schem, update_vb_schema } = require('../schema/dynamic')

// 实例化路由模块
const router = express.Router()

// 发布动态路由
router.post('/relase', expressJoi(weite_dynamic_schema), release)

// 获取动态信息路由
router.get('/obtain', obtain)

// 删除动态路由
router.post('/delete', expressJoi(delete_dynamic_schema), deleteDynamic)

// 已id为参数获取动态详情
router.get('/getbyid', expressJoi(getById_dynamic_schema), getById)

// 修改动态详情
router.post('/update', express(update_content_schem), updateDynamic)

// 修改可见性
router.post('/updatevb', express(update_vb_schema), updateVisibility)


// 向外暴露共享实例对象 router
module.exports = router